Browse Source

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

csx 3 years ago
parent
commit
95ff8fa8ad
3 changed files with 54 additions and 8 deletions
  1. 4 2
      conf/app.conf
  2. 44 6
      controllers/sg/his_api_controller.go
  3. 6 0
      service/his_service.go

+ 4 - 2
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9532
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 #
6 6
 copyrequestbody = true
@@ -54,8 +54,10 @@ front_end_domain = "https://xt.kuyicloud.com/#"
54 54
 url = "http://192.168.1.88:6666/szsi-portal/transData"
55 55
 gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56 56
 #gdyb_paasid = "sg03_prd"
57
-gdyb_paasid = "jm_sc_yjyy"
57
+#gdyb_paasid = "jm_sc_yjyy"
58 58
 #gdyb_paasid = "zh_prd_yjyy"
59
+gdyb_passid = "sz_prd_yjyy"
60
+
59 61
 
60 62
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
61 63
 readmysqlport = 3306

+ 44 - 6
controllers/sg/his_api_controller.go View File

@@ -1889,9 +1889,24 @@ func (c *HisApiController) GetRegisterInfo() {
1889 1889
 			his.Mtime = time.Now().Unix()
1890 1890
 			his.Status = 1
1891 1891
 			service.UpdateHisPatientStatus(&his)
1892
-			lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1893
-			if len(lists) == 1 {
1894
-				service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
1892
+
1893
+			getYear := time.Now().Format("2006") //获取年
1894
+			getMonth := time.Now().Format("01")  //获取月
1895
+			getDay := time.Now().Format("02")
1896
+
1897
+			new_time := getYear + "-" + getMonth + "-" + getDay
1898
+
1899
+			new_timestamp, _ := time.ParseInLocation(timeLayout+" 15:04:05", new_time+" 00:00:00", loc)
1900
+
1901
+			if recordDateTime < new_timestamp.Unix() {
1902
+				thisTime := time.Now()
1903
+				thisTime = thisTime.AddDate(0, 0, -7)
1904
+				service.UpdateHisPrescriptionHisIDTwo(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId, thisTime.Unix())
1905
+			} else if recordDateTime == new_timestamp.Unix() {
1906
+				lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1907
+				if len(lists) == 1 {
1908
+					service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
1909
+				}
1895 1910
 			}
1896 1911
 			c.ServeSuccessJSON(map[string]interface{}{
1897 1912
 				"his_info": his,
@@ -1949,6 +1964,9 @@ func (c *HisApiController) GetUploadInfo() {
1949 1964
 	sick_type, _ := c.GetInt64("sick_type")
1950 1965
 	reg_type, _ := c.GetInt64("p_type")
1951 1966
 
1967
+	id_str := c.GetString("ids")
1968
+	ids_arr := strings.Split(id_str, ",")
1969
+
1952 1970
 	timeLayout := "2006-01-02"
1953 1971
 	loc, _ := time.LoadLocation("Local")
1954 1972
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
@@ -2071,7 +2089,13 @@ func (c *HisApiController) GetUploadInfo() {
2071 2089
 
2072 2090
 			data := make(map[string]interface{})
2073 2091
 			if settle_accounts_type == 1 { //日结
2074
-				prescriptions, _ = service.GetNewHisPrescriptionTwo(adminUser.CurrentOrgId, his_patient_id, recordDateTime, reg_type)
2092
+
2093
+				if reg_type == 11 {
2094
+					prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
2095
+				} else {
2096
+					prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
2097
+				}
2098
+				//prescriptions, _ = service.GetNewHisPrescriptionTwo(adminUser.CurrentOrgId, his_patient_id, recordDateTime, reg_type)
2075 2099
 				data["pre"] = prescriptions
2076 2100
 
2077 2101
 			} else { //月结
@@ -2098,6 +2122,10 @@ func (c *HisApiController) GetUploadInfo() {
2098 2122
 
2099 2123
 			}
2100 2124
 
2125
+			if reg_type == 1111 || reg_type == 1112 {
2126
+				reg_type = 11
2127
+			}
2128
+
2101 2129
 			timestamp := time.Now().Unix()
2102 2130
 			tempTime := time.Unix(timestamp, 0)
2103 2131
 			timeFormat := tempTime.Format("20060102150405")
@@ -3163,6 +3191,9 @@ func (c *HisApiController) GetPreUploadInfo() {
3163 3191
 	sick_type, _ := c.GetInt64("sick_type")
3164 3192
 	reg_type, _ := c.GetInt64("p_type")
3165 3193
 
3194
+	id_str := c.GetString("ids")
3195
+	ids_arr := strings.Split(id_str, ",")
3196
+
3166 3197
 	timeLayout := "2006-01-02"
3167 3198
 	loc, _ := time.LoadLocation("Local")
3168 3199
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
@@ -3260,9 +3291,12 @@ func (c *HisApiController) GetPreUploadInfo() {
3260 3291
 
3261 3292
 		data := make(map[string]interface{})
3262 3293
 		if settle_accounts_type == 1 { //日结
3263
-			prescriptions, _ = service.GetNewHisPrescriptionTwo(adminUser.CurrentOrgId, his_patient_id, recordDateTime, reg_type)
3294
+			if reg_type == 11 {
3295
+				prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
3296
+			} else {
3297
+				prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
3298
+			}
3264 3299
 			data["pre"] = prescriptions
3265
-
3266 3300
 		} else { //月结
3267 3301
 			start_time_str := c.GetString("start_time")
3268 3302
 			end_time_str := c.GetString("end_time")
@@ -3286,6 +3320,10 @@ func (c *HisApiController) GetPreUploadInfo() {
3286 3320
 			data["pre"] = prescriptions
3287 3321
 		}
3288 3322
 
3323
+		if reg_type == 1111 || reg_type == 1112 {
3324
+			reg_type = 11
3325
+		}
3326
+
3289 3327
 		client := &http.Client{}
3290 3328
 		data["psn_no"] = his.PsnNo
3291 3329
 		data["mdtrt_id"] = his.Number

+ 6 - 0
service/his_service.go View File

@@ -1227,6 +1227,12 @@ func UpdateHisPrescriptionHisID(his_patient_id int64, patient_id int64, record_t
1227 1227
 	return
1228 1228
 }
1229 1229
 
1230
+func UpdateHisPrescriptionHisIDTwo(his_patient_id int64, patient_id int64, record_time int64, org_id int64, start_time int64) {
1231
+	XTWriteDB().Model(&models.HisPrescription{}).Where("record_date <= ? AND record_date >= ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0 AND order_status <> 2", record_time, start_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1232
+	XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0 AND order_status <> 2", record_time, start_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1233
+	return
1234
+}
1235
+
1230 1236
 func GetHisPatientInfoList(org_id int64, patient_id int64, record_date int64) (info []*models.HisPatient, err error) {
1231 1237
 	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ?", org_id, record_date, patient_id).Find(&info).Error
1232 1238
 	return