Procházet zdrojové kódy

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx před 3 roky
rodič
revize
c4a474a700

+ 3 - 3
controllers/sg/his_api_controller.go Zobrazit soubor

@@ -2074,14 +2074,14 @@ func (c *HisApiController) GetUploadInfo() {
2074 2074
 
2075 2075
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2076 2076
 	fmt.Println(his_patient_id)
2077
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
2077
+	his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2078 2078
 	timestamp := time.Now().Unix()
2079 2079
 	tempTime := time.Unix(timestamp, 0)
2080 2080
 	timeFormat := tempTime.Format("20060102150405")
2081 2081
 	chrgBchno := rand.Intn(100000) + 10000
2082 2082
 	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
2083 2083
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2084
-	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
2084
+	patientPrescription, _ := service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2085 2085
 	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
2086 2086
 	strconv.FormatInt(his.PatientId, 10)
2087 2087
 
@@ -2232,7 +2232,7 @@ func (c *HisApiController) GetUploadInfo() {
2232 2232
 
2233 2233
 			}
2234 2234
 			service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
2235
-			service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, chrg_bchno, recordDateTime)
2235
+			service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
2236 2236
 
2237 2237
 			var total float64
2238 2238
 			for _, item := range prescriptions {

+ 4 - 4
models/his_models.go Zobrazit soubor

@@ -1,7 +1,5 @@
1 1
 package models
2 2
 
3
-import "time"
4
-
5 3
 type XtHisProject struct {
6 4
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
7 5
 	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
@@ -117,11 +115,13 @@ type HisPatient struct {
117 115
 	IptOtpNo               string  `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
118 116
 	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
119 117
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
118
+	IdCardType             int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
119
+	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
120
+	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
121
+	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
120 122
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
121 123
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
122 124
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
123
-	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
124
-	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
125 125
 }
126 126
 
127 127
 func (HisPatient) TableName() string {

+ 12 - 0
service/his_service.go Zobrazit soubor

@@ -508,6 +508,12 @@ func FindPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int
508 508
 
509 509
 }
510 510
 
511
+func FindHisPatientPrescriptionInfo(org_id int64, his_patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
512
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND his_patient_id = ?", org_id, record_date, his_patient_id).First(&info).Error
513
+	return
514
+
515
+}
516
+
511 517
 func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
512 518
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
513 519
 	return
@@ -564,6 +570,12 @@ func UpDatePrescriptionInfoNumber(user_org_id int64, id int64, number string, re
564 570
 	return
565 571
 }
566 572
 
573
+func UpDateHisPrescriptionInfoNumber(user_org_id int64, his_patient_id int64, number string, record_time int64) (err error) {
574
+	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND his_patient_id = ? AND record_date = ?", user_org_id, his_patient_id, record_time).Updates(map[string]interface{}{"batch_number": number, "prescription_status": 2, "mtime": time.Now().Unix()}).Error
575
+
576
+	return
577
+}
578
+
567 579
 type HisOrder struct {
568 580
 	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
569 581
 	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`